package com.tsy.graduate.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tsy.graduate.bean.Course;
import com.tsy.graduate.bean.User;
import com.tsy.graduate.mapper.CourseMapper;
import org.omg.PortableInterceptor.INACTIVE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseService extends ServiceImpl<CourseMapper, Course> {
    @Autowired
    CourseMapper courseMapper;

    public List<Course> getCourseList(Long userId) {
        QueryWrapper<Course> queryWrapper = new QueryWrapper<>();
        QueryWrapper<User> userQueryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(Course::getTeacherId, userId);
        return this.list(queryWrapper);
    }
    public Long saveAndId(Course course){
        int a=  courseMapper.insert(course);
        return course.getId();
    }
}
